package com.mapper;

import com.pojo.OrderItem;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrderItemMapper {
    @Select("SELECT * FROM order_item WHERE order_id = #{orderId}")
    List<OrderItem> findByOrderId(Long orderId);


    @Insert("INSERT INTO order_item(order_id, product_id, quantity, unit_price) VALUES(#{orderId}, #{productId}, #{quantity}, #{unitPrice})")
    void insert(OrderItem item);
}
